{include file="common/head"/}
<style>
    .layui-form-pane .layui-form-label{
        width: 172px;
    }
</style>
<div class="admin-main layui-anim layui-anim-upbit">
    <fieldset class="layui-elem-field layui-field-title">
        <legend>酒店规则设置</legend>
    </fieldset>
    <form class="layui-form layui-form-pane">
        <input type="hidden" name="id" id="" value="1">
        <div class="layui-form-item">
            <label class="layui-form-label">优惠券使用规则</label>
            <div class="layui-input-4" style="width:80%;height:350px;">
               <script id="coupon_rule" lay-verify="required" name="coupon_rule"  type="text/plain" style="width:80%; height:200px;">{$list.coupon_rule}</script>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">次卡使用规则</label>
            <div class="layui-input-4" style="width:80%;height:350px;">
               <script id="second_rule" name="second_rule" lay-verify="required"  type="text/plain" style="width:80%; height:200px;">{$list.second_rule}</script>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">充值卡使用规则</label>
            <div class="layui-input-4" style="width:80%;height:350px;">
               <script id="recharge_rule" name="recharge_rule" lay-verify="required"  type="text/plain" style="width:80%; height:200px;">{$list.recharge_rule}</script>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">订单须知</label>
            <div class="layui-input-4" style="width:80%;height:350px;">
               <script id="order_rule" name="order_rule"  lay-verify="required" type="text/plain" style="width:80%; height:200px;">{$list.order_rule}</script>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">订单政策</label>
            <div class="layui-input-4" style="width:80%;height:350px;">
               <script id="order_policy" name="order_policy" lay-verify="required" type="text/plain" style="width:80%; height:200px;">{$list.order_policy}</script>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">会员权益</label>
            <div class="layui-input-4" style="width:80%;height:350px;">
               <script id="vip_equity" name="vip_equity"  type="text/plain" lay-verify="required" style="width:80%; height:200px;">{$list.vip_equity}</script>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">订房规则</label>
            <div class="layui-input-4" style="width:80%;height:350px;">
               <script id="hotel_rule" name="hotel_rule"  type="text/plain" lay-verify="required" style="width:80%; height:200px;">{$list.hotel_rule}</script>
            </div>
        </div>

        



        <div class="layui-form-item">
            <div class="layui-input-block">
                <button type="button" class="layui-btn" id="submit" lay-submit=""
                    lay-filter="sys">{:lang('submit')}</button>
            </div>
        </div>
    </form>
</div>
{include file="common/foot"/}
<script>
    var ue = UE.getEditor('coupon_rule');
    ue.ready(function(){
        ue.addListener("contentChange", function () {
	    $('#coupon_rule').val(ue.getContent());
    });
    })
    var second_rule = UE.getEditor('second_rule');
    second_rule.ready(function(){
        second_rule.addListener("contentChange", function () {
	    $('#second_rule').val(ue.getContent());
    });
    })
    var recharge_rule = UE.getEditor('recharge_rule');
    recharge_rule.ready(function(){
        recharge_rule.addListener("contentChange", function () {
	    $('#recharge_rule').val(ue.getContent());
    });
    })
    var order_rule = UE.getEditor('order_rule');
    order_rule.ready(function(){
        order_rule.addListener("contentChange", function () {
	    $('#order_rule').val(ue.getContent());
    });
    })
    var order_policy = UE.getEditor('order_policy');
    order_policy.ready(function(){
        order_policy.addListener("contentChange", function () {
	    $('#order_policy').val(ue.getContent());
    });
    })
    var vip_equity = UE.getEditor('vip_equity');
    vip_equity.ready(function(){
        vip_equity.addListener("contentChange", function () {
	    $('#vip_equity').val(ue.getContent());
    });
    })
    var hotel_rule = UE.getEditor('hotel_rule');
    hotel_rule.ready(function(){
        hotel_rule.addListener("contentChange", function () {
	    $('#hotel_rule').val(ue.getContent());
    });
    })






    layui.use(['form', 'layer', 'upload'], function () {
        var form = layui.form, layer = layui.layer, upload = layui.upload, $ = layui.jquery;

        form.verify({

            site_name: function (value) {
                if (value == '') {
                    return '请输入网站名称！';
                }
            },
            background_title: function (value) {
                if (value == '') {
                    return '请输入后台标题！';
                }
            },
            background_image: function (value) {
                if (value == '') {
                    return '请添加登录图！';
                }
            }
        });
       //提交监听
        form.on('submit(sys)', function (data) {
            $("#submit").attr({ disabled: "disabled" });
            loading = layer.load(1, { shade: [0.1, '#fff'] });
            $.post("{:url('hotelrule/index')}", data.field, function (res) {
                layer.close(loading);
                if (res.errorCode == 8888) {
                    layer.msg(res.msg, { icon: 1, time: 1000 }, function () {
                        location.href = res.url;
                    });
                } else {
                    $("#submit").removeAttr("disabled");
                    layer.msg(res.msg, { icon: 2, time: 1000 });
                }
            });
        })
    })


</script>


</body>

</html>